package com.zoiz.base.controller;

import com.google.gson.Gson;
import com.zoiz.base.model.Admin_menu;
import com.zoiz.plus.Path;
import com.zoiz.plus.extend.Controller;
import com.zoiz.plus.renderer.Renderer;
@Path("/admin/menu")
public class AdminMenuController extends Controller {
	@Path("/index")
	public Renderer index(){
		StringBuilder sql = new StringBuilder();
		sql.append("SELECT node.*");
		sql.append("  FROM admin_menu node, admin_menu parent");
		sql.append(" WHERE node.lft BETWEEN parent.lft+1 AND parent.rgt");
		sql.append("   AND parent.id = 1 ORDER BY node.lft");
		String menuJson = new Gson().toJson(Admin_menu.findAllBy(sql.toString()));
		push("menus", menuJson);
		return render("admin/menu-manage.html");
	}
	@Path("/neworedit")
	public Renderer edit(){
		return null;
		
	}
	@Path("/save")
	public Renderer save(){
		return null;
	}
	@Path("/delete/$1")
	public Renderer delete(Long id){
		return null;
	}
}
